import 'package:class_teacher_student/model/section.dart';
import 'package:class_teacher_student/model/student.dart';
import 'package:flutter/cupertino.dart';
import 'package:mock_data/mock_data.dart';
import 'package:uuid/uuid.dart';

class MockTestData {
  static List<Section> getDatas(){
    int sectionCount = 100;
    int studentCount = 50;
    var sections = List<Section>();
    for(int i=0; i<sectionCount; i++) {
      var section = Section()
        ..key = GlobalKey()
        ..cid =Uuid().v1()
        ..cname =mockName()
        ..tid =Uuid().v1()
        ..tname =mockName();
        section.letter =section.tname.substring(0,1);
      var students = List<Student>();
      for(int j=0; j<studentCount; j++) {
          var student = Student()
              ..sid =Uuid().v1()
              ..sname = mockName();
          students.add(student);
      }
      section.students = students;
      sections.add(section);
    }

    //老师+教室名字升序
    sections.sort((a,b) => (
        (a.tname+a.cname).compareTo(b.tname+b.cname)
    ));

    //学生名字升序
    for(var section in sections){
      section.students.sort((a,b) => (
          a.sname.compareTo(b.sname)
      ));
    }

    return sections;
  }
}